<?php
namespace App\Api;

use PhalApi\Api;

/**
 * 默认接口服务类
 *
 * @author: dogstar <chanzonghuang@gmail.com> 2014-10-04
 */

class Home extends Api {

	public function getRules() {
        return array(
            'index' => array(
                'username' 	=> array('name' => 'username', 'default' => 'Admin'),
            ),
            'initSlider'=>array(),
            'getViewTopUrl'=>array(),
            'initViewTop'=>array(),
            'initRecyclerView'=>array(),
        );
	}
	
	/**
	 * 默认接口服务
     * @desc 默认接口服务，当未指定接口服务时执行此接口服务
	 * @return array
     * @return string content 内容
	 * @return string version 版本，格式：X.X.X
	 * @return int time 当前时间戳
	 */
    public function index() {
        return array(
            'title' => 'Hello ' . $this->username,
             'time' => $_SERVER['REQUEST_TIME'],
        );

    }
    public function initSlider(){
        return array(
            array('id'=>'1','name'=>'测试1','imgUrl'=>'http://7mno4h.com2.z0.glb.qiniucdn.com/5608f3b5Nc8d90151.jpg','type'=>'1'),
            array('id'=>'2','name'=>'测试2','imgUrl'=>'http://7mno4h.com2.z0.glb.qiniucdn.com/5608eb8cN9b9a0a39.jpg','type'=>'1'),
            array('id'=>'3','name'=>'测试3','imgUrl'=>'http://7mno4h.com2.z0.glb.qiniucdn.com/5608cae6Nbb1a39f9.jpg','type'=>'1'),
            array('id'=>'4','name'=>'测试4','imgUrl'=>'http://7mno4h.com2.z0.glb.qiniucdn.com/5608b7cdN218fb48f.jpg','type'=>'1'),
            array('id'=>'5','name'=>'测试5','imgUrl'=>'http://7mno4h.com2.z0.glb.qiniucdn.com/560b5a7eN214306c8.jpg','type'=>'1'),

        );
    }
    public function getViewTopUrl()
    {
        return array('测试地址0','测试地址1','测试地址2','测试地址3','测试地址4',);
    }

    public function initViewTop()
    {
        return array('消息测试0','消息测试1','消息测试2','消息测试3','消息测试4',);
    }

    public function initRecyclerView()
    {
        return array(
            array(
                'cpOne'=>array('id'=>'17','title'=>'手机专享','imgUrl'=>'http://7mno4h.com2.z0.glb.qiniucdn.com/555c6c90Ncb4fe515.jpg'),
                'cpTwo'=>array('id'=>'15','title'=>'闪购','imgUrl'=>'http://7mno4h.com2.z0.glb.qiniucdn.com/560a26d2N78974496.jpg'),
                'cpThree'=>array('id'=>'11','title'=>'团购','imgUrl'=>'http://7mno4h.com2.z0.glb.qiniucdn.com/560be0c3N9e77a22a.jpg'),
                'id'=>'1',
                'title'=>'超值购',
                'campaignOne'=>'17',
                'campaignTwo'=>'15',
                'campaignThree'=>'11',
            ),

            array(
                'cpOne'=>array('id'=>'5','title'=>'玩转十一','imgUrl'=>'http://7mno4h.com2.z0.glb.qiniucdn.com/5608dc8eN07767119.jpg'),
                'cpTwo'=>array('id'=>'6','title'=>'懵懂','imgUrl'=>'http://7mno4h.com2.z0.glb.qiniucdn.com/5608da79Ncefc3eca.jpg'),
                'cpThree'=>array('id'=>'18','title'=>'联想','imgUrl'=>'http://7mno4h.com2.z0.glb.qiniucdn.com/5608dbd5Ne9147a48.jpg'),
                'id'=>'2',
                'title'=>'超值购',
                'campaignOne'=>'5',
                'campaignTwo'=>'6',
                'campaignThree'=>'18',
            ),

        );
    }

}
